<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.net.URL,java.util.*,java.io.*"%>
<%@ page import="java.net.URLConnection"%>
<%
	String topic = request.getParameter("topic");
	String rsz = request.getParameter("rsz");
	URL url = new URL(
			"https://ajax.googleapis.com/ajax/services/search/news?v=1.0&topic=" + topic + "&rsz=" + rsz);
	
	URLConnection connection = url.openConnection();
	connection.addRequestProperty("Referer", "www.7moke.com");

	connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1");
	connection.addRequestProperty("Accept-Language", "zh-cn,zh;q=0.5");

	String line;
	StringBuilder builder = new StringBuilder();
	BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
	
	while ((line = reader.readLine()) != null) {
		builder.append(line);
	}
	reader.close();
	out.println(builder.toString());
%>